from datetime import datetime

from django.contrib.auth.models import AbstractUser
from django.db import models


# Create your models here.
class BaseModel(models.Model):
    update_time = models.DateTimeField(auto_now_add=True, verbose_name='更新时间')

    class Meta:
        abstract = True


class User(BaseModel, AbstractUser):
    phone = models.CharField(max_length=11, verbose_name='手机号')
    usertype = models.SmallIntegerField(choices=((1, '普通用户'), (2, '管理员')),default=1 ,  verbose_name='用户类型')

    class Meta:
        db_table = 'user'
        verbose_name = '用户表'
        verbose_name_plural = verbose_name


class VerifyCode(BaseModel):
    code = models.CharField(max_length=4)
    phone = models.CharField(max_length=11)

    class Meta:
        db_table = 'verify_code'
        verbose_name = '验证码表'
        verbose_name_plural = verbose_name
